class Solution {
public:
    unordered_map<int, int> ma;
    bool canReach(vector<int>& arr, int start) {
        queue<int> que;
        que.push(start);
        while (!que.empty())
        {
            int temp = que.front();
            que.pop();
            if (arr[temp] == 0) return 1;
            int n1 = temp + arr[temp], n2 = temp - arr[temp];
            if (!ma[n1] && n1 >= 0 && n1 < arr.size())
            {
                ma[n1] = 1;
                que.push(n1);
            }
            if (!ma[n2] && n2 >= 0 && n2 < arr.size())
            {
                ma[n2] = 1;
                que.push(n2);
            }
        }
        return 0;
    }
};